package com.ss.android.article.base.feature.detail2.widget.a;

import android.content.Context;
import android.content.res.Resources;
import android.widget.TextView;
import com.bytedance.common.utility.UIUtils;
import com.ss.android.article.base.feature.detail.model.MixedAdsData;
import com.ss.android.article.browser.R;
import com.ss.android.article.common.NightModeAsyncImageView;

public final class DetailAdMixBannerLayout extends BaseDetailLayout {
    private NightModeAsyncImageView adMixBannerImageIv;
    private TextView adMixBannerDescTv;
    private TextView adMixBannerLabelTv;

    public DetailAdMixBannerLayout(Context arg1) {
        super(arg1);
    }

    public final void a(MixedAdsData arg3) {
        if(arg3 != null) {
            this.adMixBannerDescTv.setText(arg3.title);
            this.adMixBannerLabelTv.setText(arg3.h);
        }
    }

    public final void a(String arg4, int arg5, int arg6) {
        this.adMixBannerImageIv.setUrl(arg4);
        this.adMixBannerImageIv.setAspectRatio((((float)arg5)) / (((float)arg6)));
    }

    public final void adaptNightMode(boolean isNightMode) {
        super.adaptNightMode(isNightMode);
        Resources resources = this.getContext().getResources();
        UIUtils.setBackgroundResource(this, R.drawable.detail_ad_banner_bg);
        UIUtils.setBackgroundResource(this.adMixBannerImageIv, R.drawable.detail_ad_banner_bg);
        this.adMixBannerDescTv.setTextColor(this.getResources().getColorStateList(com.ss.android.article.browser.R.color.detail_ad_banner_desc));
        this.adMixBannerImageIv.adaptNightMode(isNightMode);
        this.adMixBannerLabelTv.setTextColor(resources.getColorStateList(com.ss.android.article.browser.R.color.ssxinzi12));
    }

    public final void initView() {
        super.initView();
        this.adMixBannerImageIv = this.findViewById(com.ss.android.article.browser.R.id.ad_mix_banner_image);
        this.adMixBannerDescTv = this.findViewById(com.ss.android.article.browser.R.id.ad_mix_banner_desc);
        this.adMixBannerLabelTv = this.findViewById(com.ss.android.article.browser.R.id.ad_mix_banner_label);
    }

    public final int getLayoutRes() {
        return R.layout.new_ad_mix_banner_layout;
    }
}

